//
//  BQFeedbackController.m
//  BeeQuick
//
//  Created by mac on 16/11/20.
//  Copyright © 2016年 six_group. All rights reserved.
//

#import "BQFeedbackController.h"
#import "BQMineViewController.h"
@interface BQFeedbackController ()<UIAlertViewDelegate>
@property(nonatomic,weak)UITextField *textField;
@end

@implementation BQFeedbackController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupUI];
    self.tabBarController.tabBar.hidden = YES;
    self.navigationItem.title = @"意见反馈";
    self.view.backgroundColor = [UIColor cz_colorWithHex:0xefefef];
    UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"v2_goback"] style:UIBarButtonItemStylePlain target:self action:@selector(buttonOF:)];
    UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"发送" style:UIBarButtonItemStylePlain target:self action:@selector(buttonRight:)];
    self.navigationItem.leftBarButtonItem = barButtonItem;
    self.navigationItem.rightBarButtonItem = rightBarButtonItem;
    rightBarButtonItem.tintColor = [UIColor cz_colorWithHex:0x646464];
}

-(void)setupUI{
    UILabel *label = [[UILabel alloc]init];
    label.text = @"你的批评和建议能帮助我们更好的完善产品,请留下你的宝贵意见!";
    label.numberOfLines = 0;
    [self.view addSubview:label];
    
    UITextField * textField = [[UITextField alloc]init];
    textField.placeholder = @"请输入宝贵意见(300字以内)";
    textField.backgroundColor = [UIColor whiteColor];
    textField.contentVerticalAlignment = UIControlContentVerticalAlignmentTop;
    textField.borderStyle = UITextBorderStyleRoundedRect;
    self.textField = textField;
    [self.view addSubview:textField];
    
    
    
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(74);
        make.left.equalTo(self.view).offset(15);
        make.right.equalTo(self.view).offset(-15);
       // make.width.equalTo(self.view);
        make.height.mas_equalTo(60);
    }];
    
    [textField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(label.mas_bottom);
        make.left.equalTo(self.view).offset(15);
        make.right.equalTo(self.view).offset(-15);
        make.height.mas_equalTo(200);
    }];
    
    
}

//自定义navigation
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.textField resignFirstResponder];
}
//pop
- (void)buttonOF:(UIBarButtonItem *)batBtn{
    
    [self.navigationController popViewControllerAnimated:YES];
    
}
//发送
-(void)buttonRight:(id)sender{
    
    //初始化提示框；
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"发送成功" preferredStyle: UIAlertControllerStyleAlert];
    
    [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        //点击按钮的响应事件；
    }]];

    //弹出提示框；
    BQMineViewController * mineVc = [[BQMineViewController alloc]init];
    [self presentViewController:alert animated:YES completion:^{
        [self presentViewController:mineVc animated:YES completion:nil];
    }];
    
    
    
}



//视图将要被移除   显示tabbar
- (void)viewWillDisappear:(BOOL)animated{
    
    [super viewWillDisappear:animated];
    self.tabBarController.tabBar.hidden = NO;
    
    
}
//视图将要显示  隐藏tabbar
- (void)viewWillAppear:(BOOL)animated{
    
    [super viewWillAppear:animated];
    
    self.tabBarController.tabBar.hidden = YES;
    
}

@end
